package one.stand.service.impl;

import com.github.vioao.wechat.api.component.wxa.CodeTemplateApi;
import com.github.vioao.wechat.bean.response.BaseResponse;
import com.github.vioao.wechat.bean.response.component.wxa.GetCodeTemplateListResponse;
import com.github.vioao.wechat.bean.response.component.wxa.GetDraftCodeTemplateListResponse;
import one.stand.model.VersionModel;
import one.stand.service.CodeTemplateService;
import one.stand.service.ComponentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author: QIK
 * @CreateDate: 2019/5/14 11:56
 */
@Service
public class CodeTemplateServiceImpl extends PublicBaseService implements CodeTemplateService {
    @Autowired
    ComponentService componentService;
    @Override
    public GetDraftCodeTemplateListResponse getTemplateDraftList() {
        String token=componentService.getComponentToken();
        return CodeTemplateApi.getTemplateDraftList(token);
    }

    @Override
    public GetCodeTemplateListResponse addTotemplate(String draftId) {
        String token=componentService.getComponentToken();
        GetCodeTemplateListResponse response=CodeTemplateApi.addTotemplate(token,draftId);
        return response;
    }

    @Override
    public GetCodeTemplateListResponse getTemplateList() {
        String token=componentService.getComponentToken();
        return CodeTemplateApi.getTemplateList(token);
    }


    @Override
    public BaseResponse delTemplate(String templateId) {
        String token=componentService.getComponentToken();
        return CodeTemplateApi.delTotemplate(token,templateId);
    }
}
